<template>
  <div>
    <!-- 设置头部框的标题颜色之类 -->
    <MyHeader
      title="购物车"
      color="#fff"
      background="orange"
    ></MyHeader>
    <!-- 动态组件设置中间部分显示什么内容 -->
    <div class="main">
      <router-view></router-view>
    </div>
    <!-- 数据给到底部去渲染底部导航 --><!-- 底部组件传回来的名字决定中间部分显示什么 -->
    <MyTabBar :list="tabList" @toggleFn="toggleFn"></MyTabBar>
  </div>
</template>
 
<script>
import MyHeader from '@/components/MyHeader'
import MyTabBar from '@/components/MyTabBar'
import MyGoodsList from '@/views/MyGoodsList'
import MyGoodsSearch from '@/views/MyGoodsSearch'
import MyUserInfo from '@/views/MyUserInfo'
export default {
  components: {
    MyHeader,
    MyTabBar,
    MyGoodsList,
    MyGoodsSearch,
    MyUserInfo
  },
  data() {
    return {
      tabList: [
        {
          iconText: 'icon-shangpinliebiao',
          text: '商品列表',
          componentName: 'MyGoodsList'
        },
        {
          iconText: 'icon-sousuo',
          text: '商品搜索',
          componentName: 'MyGoodsSearch'
        },
        {
          iconText: 'icon-user',
          text: '我的信息',
          componentName: 'MyUserInfo'
        }
      ],
      comName: 'MyGoodsList'
    }
  },
  methods: {
    toggleFn(name){
      this.comName = name
    }
  }
}
</script>

<style scoped>
.main{
  padding-top: 45px;
  padding-bottom: 51px;
}
</style>